home *** CD-ROM | disk | FTP | other *** search
- {$X+,B-,V-} {essential compiler directives}
-
- program swapnames; { as of 950301 }
-
- { Example for the nwBindry unit / NwTP 0.6 API. (c) 1993,1995, R.Spronk }
-
- { AREA:NOVELL
- (1394) Thu 30 Sep 93 16:07
- By: JAMES SIMONSON
- To: All
- Re: Novell 3.11/4.01 bindery access
- ------------------------------------------------------------
-
- Is there a way to access the full name information inthe bindery files?
- Here's the scoop:
-
- We've got "firstname mi lastname" in the FULLNAME space in the user record.
- We need to convert that to "lastname, firstname mi" & place that
- information BACK into the FULLNAME field. Is there any relatively fast way
- to do this conversion?
-
- --- SLMAIL v3.0 (#0623)
- * Origin: WorkStations Unlimited / 312-404-2824 (1:115/404) }
-
- { This program will reverse all first & last names in the bindery.
- Lastname is defined as being everything after the last space in the full name.
- This may not be true for all names.
- If there is no space in the full name, nothing changes. }
-
- uses nwBindry;
-
- Var lastObjSeen:LongInt;
- objName :string;
- objType :word;
- objId :LongInt;
- objFlag,objSec:Byte;
- hasProp :boolean;
-
- propVal :Tproperty;
- moreseg :boolean;
- propFlags:Byte;
-
- NewName,FullName:string;
- t:byte;
- s:string;
- begin
- IF NOT IsShellLoaded
- then begin
- writeln('Load network shell before executing this testprogram.');
- halt(1);
- end;
-
- writeln('SWAPNAME: Will swap the first and last names of the IDENTIFICATION');
- writeln(' property in the bindery. (Full Name of an object)');
- writeln;
- writeln('--WARNING: Changes the property values irrevokably ! --');
- writeln;
- writeln('Type ''y'' and <Return> to continue.. (all else will abort)');
- readln(s);
- if (s[0]=#0) or ((s[1]<>'y') and (s[1]<>'Y'))
- then halt(1);
-
- LastObjSeen:=-1;
- WHILE ScanBinderyObject('*',1,LastObjSeen,
- objName,objType,objId,objFlag,objSec,hasProp)
- do begin
- IF ReadPropertyValue(objName,objType,'IDENTIFICATION',1,
- propVal,moreSeg,propFlags)
- then begin
- t:=1;
- while (propVal[t]<>0)
- do begin FullName[t]:=chr(propVal[t]);inc(t) end;
- FullName[0]:=chr(t-1);
- IF pos(',',FullName)=0
- then begin
- writeln(FullName);
- while fullName[ord(fullName[0])]=' '
- do dec(FullName[0]);
- t:=ord(FullName[0]);
- while (t>0) and (FullName[t]<>' ') do dec(t);
- if t>0
- then begin
- NewName:=copy(FullName,t+1,255)+', '
- +copy(FullName,1,t-1);
- writeln(newname);
- fillChar(propVal,SizeOf(propVal),#0);
- for t:=1 to ord(newName[0])
- do propVal[t]:=ord(newName[t]);
- WritePropertyValue(objName,objType,
- 'IDENTIFICATION',1,propVal,FALSE);
- end;
- end;
- end;
- end;
- if nwBindry.result<>$FC then writeln('error scanning bindery');
- end.
-